void deD(){
  TFile *f = new TFile(getenv("TMP1"));
  TTree *etf = (TTree *)f->Get("etf");
  char zcut[64] = "";
  static const int Z = 29;
  if(Z > 0) sprintf(zcut, "az0>%.2f && az0<%.2f", Z-0.5, Z+0.5);

  const int rg[2][2][2][2] = { // D[0,1][X-Y][0-1][L,H]
    {{{8, 8}, {8, 8}}, {{6, 7}, {7, 7}}},
    {{{9, 9}, {8, 9}}, {{6, 6}, {6, 6}}}
    // {0, 15}, {0, 15}, {0, 15}, {0, 15}
  }; // wire Id range for X0, X1, Y0 and Y1

  char hname[128]{};
  TH1F *h0[2], *h1[2];
  const char xy[2] = {'X', 'Y'};
  char ly[4][128]{}, dc[16]{};
  for(int II = 0; II < 2; II++){ // loop over 0-1
    sprintf(dc, "dcTaD%d", II);
    sprintf(hname, "h%s", dc);
    h0[II] = new TH1F(hname, Form("%s Drift Time", dc), 2000, -100., 400.);
    h1[II] = new TH1F(Form("hrt_%s", dc), Form("R(t) for %s", dc), 2000, -100., 400.);
    h0[II]->GetXaxis()->SetTitle("drift time [ns]");
    h0[II]->GetYaxis()->SetTitle("counts");
    h1[II]->GetXaxis()->SetTitle("drift time [ns]");
    h1[II]->GetYaxis()->SetTitle("drift distance [mm]");
    h1[II]->SetLineColor(2);
    for(int i = 2; i--;) for(int j = 2; j--;){
      const int k = 2*i + j;
      sprintf(ly[i], "%s%c%d", dc, xy[i], j);
      etf->Project(Form("+%s", hname), Form("%s.GetT()", ly[i]),
        Form("%s&&%s.GetWireId()>=%d&&%s.GetWireId()<=%d&&fabs(postTaTracker%c.ang())<1.",
          zcut, ly[i], rg[II][i][j][0], ly[i], rg[II][i][j][1], xy[i]));
    } // end for over i
    // integral
    for(int i = 1; i < h0[II]->GetNbinsX(); i++)
      h1[II]->SetBinContent(i, h0[II]->Integral(1, i));
    h1[II]->Scale(5. / h0[II]->Integral());
    cout << "Processing " << hname << " zcut: " << zcut << '\r' << flush;
  } // end for over D0,1

  TFile *frt = new TFile("rt.root", "UPDATE");
  TCanvas *c = new TCanvas("c", "c", 1600, 800);
  c->Divide(2, 2);
  for(int i = 0; i < 2; i++){
    c->cd(2*i + 1); h0[i]->Draw();
    c->cd(2*i + 2); h1[i]->Draw();
    h1[i]->Write("", TObject::kOverwrite);
  } // end for
} // end function de
